<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2022/3/21
 * Time: 15:56
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

namespace app\api\controller\v1;

use app\admin\model\BuddhaArticle;
use app\admin\model\BuddhaBanner;
use app\admin\model\BuddhaBuddha;
use app\common\lib\Show;
use app\common\lib\Status;

class Index extends Base
{
    public function getIndexByListInfo()
    {
        //获取走进活佛文章
        $page = $this->request->param('page', 1);
        $limit = $this->request->param('limit', 10, 'intval');
        $article = (new BuddhaArticle())->getPaginateByNormalListInfo([['is_activity', '<>', 1]], $limit);
        $activity = (new BuddhaArticle())->getPaginateByNormalListInfo([['is_activity', '=', 1]], $limit);
        $banner = (new BuddhaBanner())
            ->where('type', 2)
            ->limit(3)
            ->select()
            ->toArray();
        $address = (new BuddhaBuddha())->where('id',1)->find();
        return Show::json_show(Status::mini_normal, "ok", [
            "article" => $article,
            "activity" => $activity,
            "advert" => $banner,
            "address"=>$address
        ]);
    }
}